﻿package Network
{	
	final public class TCPConstants 
	{
		//PACKETS IDS
		
		//sending from client to handshake and from server to inform about new client
		public static const ID_NewClient:int = 0;
		//Sending from server to inform all about some client exit
		public static const ID_ClientExit:int = 1;
		//Creating battle on client side and informig all other clients
		public static const ID_NewBattle:int = 2;
		public static const ID_RemoveBattle:int = 3;
		public static const ID_RequestBattle:int = 4;
		public static const ID_AcceptBattle:int = 5;
		public static const ID_DeclineBattle:int = 6;
		public static const ID_ConnectionRejected:int = 7;
		public static const ID_BattlesList:int = 8;
		public static const ID_Beat:int = 9;
		
		//FROM CLIENT ONLY
		public static const ID_BattlesListRequest:int = 256;
		
		//EVENTS
		
		public static const NEW_CLIENT:String = 'NEW_CLIENT';
		public static const CLIENT_EXIT:String = 'CLIENT_EXIT';
		public static const NEW_BATTLE:String = 'NEW_BATTLE';
		public static const REMOVE_BATTLE:String = 'REMOVE_BATTLE';
		public static const REQUEST_BATTLE:String = 'REQUEST_BATTLE';
		public static const ACCEPT_BATTLE:String = 'ACCEPT_BATTLE';
		public static const DECLINE_BATTLE:String = 'DECLINE_BATTLE';
		public static const CONNECTION_REJECTED:String = 'CONNECTION_REJECTED';
		public static const BATTLES_LIST:String = 'BATTLES_LIST';
		public static const BEAT:String = 'BEAT';
		
		public static const Events:Array = new Array
		(
			/*0*/  NEW_CLIENT,
			/*1*/  CLIENT_EXIT,
			/*2*/  NEW_BATTLE,
			/*3*/  REMOVE_BATTLE,
			/*4*/  REQUEST_BATTLE,
			/*5*/  ACCEPT_BATTLE,
			/*6*/  DECLINE_BATTLE,
			/*7*/  CONNECTION_REJECTED,
			/*8*/  BATTLES_LIST,
			/*9*/  BEAT
		);
	}	
}
